<include file="Public:header" />
<include file="Public:navgation" />
<style>.categorybtn{border-radius:0; margin:0; border:none;}
.categorybtn.on{background:#fff; color:#47AEC8;}
</style>
<script src="__PUBLIC__/Js/highcharts.src.js"></script>
<div class="container-fluid main-content">
    <div class="page-title chart-container"> </div>
    <div class="row">
        <div class="col-md-12 col-sm-12">
            <div class="row">
                <!-- Area Charts:Morris --><!-- Chat -->
                <div class="col-md-6 col-lg-6">
                    <div class="widget-container scrollable chat" style="height: 427px;margin-top:10px">
                        <div class="heading">
                            <i class="glyphicon glyphicon-cog"></i>个人积分情况
                        </div>
                        <div class="widget-content padded">
                            <div class="chart-graph line-chart">
                                <div id="containero" style="min-width: 310px; height: 300px; margin: 0 auto">
                                </div>
                                <script type="text/javascript">
                                    $(function () {
                                        $('#containero').highcharts({
                                            chart: {type: 'spline'},
                                            title: {text: '个人积分变动情况' },
                                            subtitle: {text: ''},
                                            xAxis: {
                                                type: 'datetime',
                                                categories: [<volist name='throw' id='date'>'{$date.date}',</volist>]
                                            },
                                            yAxis: {
                                                title: {
                                                    text: '积分数量'
                                                },
                                                minorGridLineWidth: 0,
                                                gridLineWidth: 0,
                                                alternateGridColor: null,
                                                plotBands: []
                                            },
                                            tooltip: {
                                                pointFormat: '获得积分: <b>{point.y} </b>分'
                                            },
                                            plotOptions: {
                                                spline: {
                                                    lineWidth: 1,
                                                    states: {
                                                        hover: {
                                                            lineWidth: 1
                                                        }
                                                    },
                                                    marker: {
                                                        enabled: false
                                                    },
                                                }
                                            },
                                            series: [{
                                                name: 'A积分',
                                                data: [ <volist name = 'throwa' id = 'ga' >{$ga.sum},</volist>]
                                            },{
                                                name: 'B积分',
                                                data: [ <volist name = 'throwb' id = 'gb' >{$gb.sum},</volist>]
                                            },{
                                                name: 'V积分',
                                                data: [ <volist name = 'throwv' id = 'gv' >{$gv.sum},</volist>]
                                        }],
                                            navigation: {
                                                menuItemStyle: {
                                                    fontSize: '2px'
                                                }
                                            },
                                            dataLabels: {
                                                enabled: true,
                                            }
                                        });
                                    });
                                </script>
                                <!-- end Line Chart -->
                            </div>
                        </div>
                    </div>
                </div>
                <!-- Area Charts:Morris --><!-- Chat -->
                <div class="col-md-6 col-lg-6">
                    <div class="widget-container scrollable  list task-widget padded" style="height: 427px;margin-top:10px">
                        <div class="heading">
                            <i class="glyphicon glyphicon-cog"></i>积分来源统计
                        </div>
                        <div class="widget-content padded">
                            <div id="container" style="min-width:400px;height:300px"></div>
                            <script>
                                $(function () {
                                    var colors = Highcharts.getOptions().colors,
                                            categories = ['A积分', 'B积分', 'V积分'],
                                            data = [{
                                                y: <notempty name='anti.30'>{$anti[30]|abs}<else />0</notempty>,
                                                color: colors[8],
                                                drilldown: {
                                                    name: 'A 积分',
                                                    categories: [<volist name='inta' id='ia'>'{$ia.formname}',</volist>],
                                                    data: [<volist name='inta1' id='ia1'>{$ia1['total']|abs},</volist>],
                                                    color: colors[8]
                                                }
                                            }, {
                                                y: <notempty name='anti.10'>{$anti[10]|abs}<else />0</notempty>,
                                                color: '#24CBE5',
                                                drilldown: {
                                                    name: 'B积分',
                                                    categories: [<volist name='intb' id='ib'>'{$ib.formname}',</volist>],
                                                    data: [<volist name='intb1' id='ib1'>{$ib1['total']|abs},</volist>],
                                                    color: '#24CBE5'
                                                }
                                            }, {
                                                y: <notempty name='anti.34'>{$anti[34]|abs}<else />0</notempty>,
                                                color: colors[2],
                                                drilldown: {
                                                    name: 'V积分',
                                                    categories: [<volist name='intv' id='iv'>'{$iv.formname}',</volist>],
                                                    data: [<volist name='intv1' id='iv1'>{$iv1['total']|abs},</volist>],
                                                    color: colors[2]
                                                }
                                            }],
                                            browserData = [],
                                            versionsData = [],
                                            i,
                                            j,
                                            dataLen = data.length,
                                            drillDataLen,
                                            brightness;
                                    // Build the data arrays
                                    for (i = 0; i < dataLen; i += 1) {
                                        // add browser data
                                        browserData.push({
                                            name: categories[i],
                                            y: data[i].y,
                                            color: data[i].color
                                        });
                                        // add version data
                                        drillDataLen = data[i].drilldown.data.length;
                                        for (j = 0; j < drillDataLen; j += 1) {
                                            brightness = 0.2 - (j / drillDataLen) / 5;
                                            versionsData.push({
                                                name: data[i].drilldown.categories[j],
                                                y: data[i].drilldown.data[j],
                                                color: Highcharts.Color(data[i].color).brighten(brightness).get()
                                            });
                                        }
                                    }
                                    // Create the chart
                                    $('#container').highcharts({
                                        chart: {
                                            type: 'pie'
                                        },
                                        title: {
                                            text: '积分来源统计表'
                                        },
                                        yAxis: {
                                            title: {
                                                text: ''
                                            }
                                        },
                                        plotOptions: {
                                            pie: {
                                                shadow: false,
                                                center: ['50%', '50%']
                                            }
                                        },
                                        tooltip: {
                                            valueSuffix: '分'
                                        },
                                        series: [{
                                            name: '所获积分',
                                            data: browserData,
                                            size: '60%',
                                            dataLabels: {
                                                formatter: function () {
                                                    return this.y > 5 ? this.point.name : null;
                                                },
                                                color: '#fee',
                                                fontfamily:'sans-serif',
                                                distance: -30
                                            }
                                        }, {
                                            name: '所获积分',
                                            data: versionsData,
                                            size: '80%',
                                            innerSize: '60%',
                                            dataLabels: {
                                                formatter: function () {
                                                    // display only if larger than 1
                                                    return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '分'  : null;
                                                }
                                            }
                                        }]
                                    });
                                });

                            </script>
                        </div>
                    </div>
                </div>
                <!-- Area Charts:Morris --><!-- Chat -->
                <div class="col-md-6 col-lg-6">
                    <div class="widget-container scrollable list task-widget padded" style="height: 427px;margin-top:10px">
                        <div class="heading">
                            <i class="glyphicon glyphicon-cog"></i>个人产值统计
                        </div>
                        <div class="widget-content">
                            <ul>
                            </ul>
                        </div>
                    </div>
                </div>
                <!-- Area Charts:Morris --><!-- Chat -->
                <div class="col-md-6 col-lg-6">
                    <div class="widget-container scrollable chat task-widget item  fluid-height social-entry" style="height: 427px;margin-top:10px">
                        <div class="heading">
                            <i class="glyphicon glyphicon-cog"></i>部门积分排名
                        </div>
                        <div class="widget-content padded dept4">
                            <script>
                                $(document).ready(function(){
                                    $.post("{:U('Analysis/department')}",function(data){
                                        $('.dept4').html(data.tbody);
                                    },'json');
                                });
                            </script>
                        </div>
                    </div>
                </div>

                <script>

                    function mission_send(id,e){
                        if(!confirm('确定递交吗？')){
                            return false;
                        }
                        hideLayer();
                        $.post('{:U('send')}', {id:id}, function(data){
                            if(data.status == 1){
                                updateList();
                            }else{
                                alert(data.info);
                            }
                        }, 'json');
                    }

                    function mission_cancel(id,e){
                        if(!confirm('确定取消吗？')){
                            return false;
                        }
                        hideLayer();
                        $.post('{:U('cancel')}', {id:id}, function(data){
                            if(data.status == 1){
                                updateList();
                            }else{
                                alert(data.info);
                            }
                        }, 'json');
                    }

                </script>
<include file="Public:footer" />